<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户注册</title>
    <script type="text/javascript" src="./script/jquery-3.6.0.min.js"></script>
    <script type="text/javascript">
    $(function (){
        $("#checkButton").click(function (){
            alert("ok--");
            $.ajax({
                url:"/ajax3_war_exploded/checkUserServlet",
                type:"POST",
                data:{
                    username:$("#uname").val(),
                    data: new Date()
                },
                error:function (){
                    console.log("失败~~");
                },
                success:function (){
                    console.log("成功")
                },
                dataType:"json"

            })
        })


    })
    </script>
</head>
<body>
<h1>用户注册~</h1>
<form action="/ajax3_war_exploded/checkUserServlet" method="post">
    用户名字:<input type="text" name="username" id="uname">
    <input type="button" id="checkButton" value="验证用户名">
    <input style="border-width: 0;color: red" type="text" id="myres"><br/><br/>
    用户密码:<input type="password" name="password"><br/><br/>
    电子邮件:<input type="text" name="email"><br/><br/>
    <input type="submit" value="用户注册">
</form>
<h1>返回的json数据</h1>
<div id="div1"></div>
</body>
</html>